[security-fix] Fix clear-text logging of sensitive information in secrets validation#7178
Merged
[security-fix] Fix clear-text logging of sensitive information in secrets validation#7178
Conversation
…secrets validation Fixes GitHub code scanning alert #71 (go/clear-text-logging) Changes: - Remove sensitive value from error messages in validateSecretsExpression - Remove sensitive value from log statements - Update tests to verify sensitive data is NOT included in errors - Add explicit test cases for security requirement This prevents leaking actual secret values in logs and error messages when validation fails, addressing CWE-312, CWE-315, and CWE-359. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
pelikhan
approved these changes
Dec 22, 2025
This was referenced Dec 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security Fix: Clear-text Logging of Sensitive Information
Alert Number: #71
Severity: High (Error)
Rule: go/clear-text-logging
CWE: CWE-312, CWE-315, CWE-359
Vulnerability Description
The secrets validation function was logging sensitive information (actual secret values) in both error messages and log statements when validation failed. This occurs in
pkg/workflow/secrets_validation.goat line 22, where the error message includedgot: %qwith the actual value, and line 21 where the log statement included the value parameter.When a user provides an invalid secret expression (e.g., a plaintext value instead of
${{ secrets.NAME }}), the actual sensitive value would be:secretsValidationLog.PrintfThis violates the security principle of never logging sensitive data in clear text.
Fix Applied
Changes to
pkg/workflow/secrets_validation.go:got: %qformat specifier and value argument from the error message (line 22)Before:
After:
Changes to
pkg/workflow/secrets_validation_test.go:notExpectedInErrsfield to test structure to explicitly verify sensitive data exclusionSecurity Best Practices Applied
✅ Principle of Least Privilege for Logging: Only log the minimum information needed for debugging (key name), never the sensitive value itself
✅ Defense in Depth: Even though the value might be invalid, we treat all input as potentially sensitive
✅ Secure by Default: Error messages are helpful but never expose sensitive data
✅ Testable Security: Added explicit tests to verify sensitive data is not leaked
Testing Considerations
All existing tests have been updated and pass successfully:
TestSecretsExpressionPattern- Pattern matching still works correctlyTestValidateSecretsExpressionErrorMessages- Error messages are descriptive but do NOT contain sensitive valuesTestValidateSecretsExpressionWithDifferentKeys- Validation logic unchangedTestSecretsValidationEdgeCases- Edge cases still handled correctlyRun tests with:
go test -v ./pkg/workflow -run TestValidateSecretsExpressionImpact
This is a security-only fix with no breaking changes:
References